3.1 \(\int \tan (c+d x) (a+b \tan (c+d x)) (B \tan (c+d x)+C \tan ^2(c+d x)) \, dx\)

Optimal. Leaf size=87 \[ \frac{(a C+b B) \tan ^2(c+d x)}{2 d}+\frac{(a B-b C) \tan (c+d x)}{d}+\frac{(a C+b B) \log (\cos (c+d x))}{d}-x (a B-b C)+\frac{b C \tan ^3(c+d x)}{3 d} \]

[Out]

-((a*B - b*C)*x) + ((b*B + a*C)*Log[Cos[c + d*x]])/d + ((a*B - b*C)*Tan[c + d*x])/d + ((b*B + a*C)*Tan[c + d*x
]^2)/(2*d) + (b*C*Tan[c + d*x]^3)/(3*d)

________________________________________________________________________________________

Rubi [A]  time = 0.133698, antiderivative size = 87, normalized size of antiderivative = 1., number of steps used = 5, number of rules used = 5, integrand size = 36, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.139, Rules used = {3632, 3592, 3528, 3525, 3475} \[ \frac{(a C+b B) \tan ^2(c+d x)}{2 d}+\frac{(a B-b C) \tan (c+d x)}{d}+\frac{(a C+b B) \log (\cos (c+d x))}{d}-x (a B-b C)+\frac{b C \tan ^3(c+d x)}{3 d} \]

Antiderivative was successfully verified.

[In]

Int[Tan[c + d*x]*(a + b*Tan[c + d*x])*(B*Tan[c + d*x] + C*Tan[c + d*x]^2),x]

[Out]

-((a*B - b*C)*x) + ((b*B + a*C)*Log[Cos[c + d*x]])/d + ((a*B - b*C)*Tan[c + d*x])/d + ((b*B + a*C)*Tan[c + d*x
]^2)/(2*d) + (b*C*Tan[c + d*x]^3)/(3*d)

Rule 3632

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_.)*((A_.) + (B_.)
*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Dist[1/b^2, Int[(a + b*Tan[e + f*x])
^(m + 1)*(c + d*Tan[e + f*x])^n*(b*B - a*C + b*C*Tan[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f, A, B, C, m,
 n}, x] && NeQ[b*c - a*d, 0] && EqQ[A*b^2 - a*b*B + a^2*C, 0]

Rule 3592

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(
e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(B*d*(a + b*Tan[e + f*x])^(m + 1))/(b*f*(m + 1)), x] + Int[(a + b*Tan[e
 + f*x])^m*Simp[A*c - B*d + (B*c + A*d)*Tan[e + f*x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B, m}, x] && NeQ[b
*c - a*d, 0] &&  !LeQ[m, -1]

Rule 3528

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(d
*(a + b*Tan[e + f*x])^m)/(f*m), x] + Int[(a + b*Tan[e + f*x])^(m - 1)*Simp[a*c - b*d + (b*c + a*d)*Tan[e + f*x
], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && GtQ[m, 0]

Rule 3525

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c - b
*d)*x, x] + (Dist[b*c + a*d, Int[Tan[e + f*x], x], x] + Simp[(b*d*Tan[e + f*x])/f, x]) /; FreeQ[{a, b, c, d, e
, f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin{align*} \int \tan (c+d x) (a+b \tan (c+d x)) \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx &=\int \tan ^2(c+d x) (a+b \tan (c+d x)) (B+C \tan (c+d x)) \, dx\\ &=\frac{b C \tan ^3(c+d x)}{3 d}+\int \tan ^2(c+d x) (a B-b C+(b B+a C) \tan (c+d x)) \, dx\\ &=\frac{(b B+a C) \tan ^2(c+d x)}{2 d}+\frac{b C \tan ^3(c+d x)}{3 d}+\int \tan (c+d x) (-b B-a C+(a B-b C) \tan (c+d x)) \, dx\\ &=-(a B-b C) x+\frac{(a B-b C) \tan (c+d x)}{d}+\frac{(b B+a C) \tan ^2(c+d x)}{2 d}+\frac{b C \tan ^3(c+d x)}{3 d}+(-b B-a C) \int \tan (c+d x) \, dx\\ &=-(a B-b C) x+\frac{(b B+a C) \log (\cos (c+d x))}{d}+\frac{(a B-b C) \tan (c+d x)}{d}+\frac{(b B+a C) \tan ^2(c+d x)}{2 d}+\frac{b C \tan ^3(c+d x)}{3 d}\\ \end{align*}

Mathematica [A]  time = 0.549577, size = 86, normalized size = 0.99 \[ \frac{3 (a C+b B) \tan ^2(c+d x)+(6 b C-6 a B) \tan ^{-1}(\tan (c+d x))+6 (a B-b C) \tan (c+d x)+6 (a C+b B) \log (\cos (c+d x))+2 b C \tan ^3(c+d x)}{6 d} \]

Antiderivative was successfully verified.

[In]

Integrate[Tan[c + d*x]*(a + b*Tan[c + d*x])*(B*Tan[c + d*x] + C*Tan[c + d*x]^2),x]

[Out]

((-6*a*B + 6*b*C)*ArcTan[Tan[c + d*x]] + 6*(b*B + a*C)*Log[Cos[c + d*x]] + 6*(a*B - b*C)*Tan[c + d*x] + 3*(b*B
 + a*C)*Tan[c + d*x]^2 + 2*b*C*Tan[c + d*x]^3)/(6*d)

________________________________________________________________________________________

Maple [A]  time = 0.013, size = 135, normalized size = 1.6 \begin{align*}{\frac{Cb \left ( \tan \left ( dx+c \right ) \right ) ^{3}}{3\,d}}+{\frac{B \left ( \tan \left ( dx+c \right ) \right ) ^{2}b}{2\,d}}+{\frac{C \left ( \tan \left ( dx+c \right ) \right ) ^{2}a}{2\,d}}+{\frac{aB\tan \left ( dx+c \right ) }{d}}-{\frac{Cb\tan \left ( dx+c \right ) }{d}}-{\frac{\ln \left ( 1+ \left ( \tan \left ( dx+c \right ) \right ) ^{2} \right ) Bb}{2\,d}}-{\frac{\ln \left ( 1+ \left ( \tan \left ( dx+c \right ) \right ) ^{2} \right ) Ca}{2\,d}}-{\frac{aB\arctan \left ( \tan \left ( dx+c \right ) \right ) }{d}}+{\frac{C\arctan \left ( \tan \left ( dx+c \right ) \right ) b}{d}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(d*x+c)*(a+b*tan(d*x+c))*(B*tan(d*x+c)+C*tan(d*x+c)^2),x)

[Out]

1/3*b*C*tan(d*x+c)^3/d+1/2/d*B*tan(d*x+c)^2*b+1/2/d*C*tan(d*x+c)^2*a+1/d*a*B*tan(d*x+c)-b*C*tan(d*x+c)/d-1/2/d
*ln(1+tan(d*x+c)^2)*B*b-1/2/d*ln(1+tan(d*x+c)^2)*C*a-1/d*a*B*arctan(tan(d*x+c))+1/d*C*arctan(tan(d*x+c))*b

________________________________________________________________________________________

Maxima [A]  time = 1.61027, size = 116, normalized size = 1.33 \begin{align*} \frac{2 \, C b \tan \left (d x + c\right )^{3} + 3 \,{\left (C a + B b\right )} \tan \left (d x + c\right )^{2} - 6 \,{\left (B a - C b\right )}{\left (d x + c\right )} - 3 \,{\left (C a + B b\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 6 \,{\left (B a - C b\right )} \tan \left (d x + c\right )}{6 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)*(a+b*tan(d*x+c))*(B*tan(d*x+c)+C*tan(d*x+c)^2),x, algorithm="maxima")

[Out]

1/6*(2*C*b*tan(d*x + c)^3 + 3*(C*a + B*b)*tan(d*x + c)^2 - 6*(B*a - C*b)*(d*x + c) - 3*(C*a + B*b)*log(tan(d*x
 + c)^2 + 1) + 6*(B*a - C*b)*tan(d*x + c))/d

________________________________________________________________________________________

Fricas [A]  time = 1.37233, size = 208, normalized size = 2.39 \begin{align*} \frac{2 \, C b \tan \left (d x + c\right )^{3} - 6 \,{\left (B a - C b\right )} d x + 3 \,{\left (C a + B b\right )} \tan \left (d x + c\right )^{2} + 3 \,{\left (C a + B b\right )} \log \left (\frac{1}{\tan \left (d x + c\right )^{2} + 1}\right ) + 6 \,{\left (B a - C b\right )} \tan \left (d x + c\right )}{6 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)*(a+b*tan(d*x+c))*(B*tan(d*x+c)+C*tan(d*x+c)^2),x, algorithm="fricas")

[Out]

1/6*(2*C*b*tan(d*x + c)^3 - 6*(B*a - C*b)*d*x + 3*(C*a + B*b)*tan(d*x + c)^2 + 3*(C*a + B*b)*log(1/(tan(d*x +
c)^2 + 1)) + 6*(B*a - C*b)*tan(d*x + c))/d

________________________________________________________________________________________

Sympy [A]  time = 1.52478, size = 139, normalized size = 1.6 \begin{align*} \begin{cases} - B a x + \frac{B a \tan{\left (c + d x \right )}}{d} - \frac{B b \log{\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac{B b \tan ^{2}{\left (c + d x \right )}}{2 d} - \frac{C a \log{\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac{C a \tan ^{2}{\left (c + d x \right )}}{2 d} + C b x + \frac{C b \tan ^{3}{\left (c + d x \right )}}{3 d} - \frac{C b \tan{\left (c + d x \right )}}{d} & \text{for}\: d \neq 0 \\x \left (a + b \tan{\left (c \right )}\right ) \left (B \tan{\left (c \right )} + C \tan ^{2}{\left (c \right )}\right ) \tan{\left (c \right )} & \text{otherwise} \end{cases} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)*(a+b*tan(d*x+c))*(B*tan(d*x+c)+C*tan(d*x+c)**2),x)

[Out]

Piecewise((-B*a*x + B*a*tan(c + d*x)/d - B*b*log(tan(c + d*x)**2 + 1)/(2*d) + B*b*tan(c + d*x)**2/(2*d) - C*a*
log(tan(c + d*x)**2 + 1)/(2*d) + C*a*tan(c + d*x)**2/(2*d) + C*b*x + C*b*tan(c + d*x)**3/(3*d) - C*b*tan(c + d
*x)/d, Ne(d, 0)), (x*(a + b*tan(c))*(B*tan(c) + C*tan(c)**2)*tan(c), True))

________________________________________________________________________________________

Giac [B]  time = 2.50916, size = 1373, normalized size = 15.78 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)*(a+b*tan(d*x+c))*(B*tan(d*x+c)+C*tan(d*x+c)^2),x, algorithm="giac")

[Out]

-1/6*(6*B*a*d*x*tan(d*x)^3*tan(c)^3 - 6*C*b*d*x*tan(d*x)^3*tan(c)^3 - 3*C*a*log(4*(tan(c)^2 + 1)/(tan(d*x)^4*t
an(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1))*tan(d*x)^3*tan(c)^3
 - 3*B*b*log(4*(tan(c)^2 + 1)/(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 -
2*tan(d*x)*tan(c) + 1))*tan(d*x)^3*tan(c)^3 - 18*B*a*d*x*tan(d*x)^2*tan(c)^2 + 18*C*b*d*x*tan(d*x)^2*tan(c)^2
- 3*C*a*tan(d*x)^3*tan(c)^3 - 3*B*b*tan(d*x)^3*tan(c)^3 + 9*C*a*log(4*(tan(c)^2 + 1)/(tan(d*x)^4*tan(c)^2 - 2*
tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1))*tan(d*x)^2*tan(c)^2 + 9*B*b*log
(4*(tan(c)^2 + 1)/(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*t
an(c) + 1))*tan(d*x)^2*tan(c)^2 + 6*B*a*tan(d*x)^3*tan(c)^2 - 6*C*b*tan(d*x)^3*tan(c)^2 + 6*B*a*tan(d*x)^2*tan
(c)^3 - 6*C*b*tan(d*x)^2*tan(c)^3 + 18*B*a*d*x*tan(d*x)*tan(c) - 18*C*b*d*x*tan(d*x)*tan(c) - 3*C*a*tan(d*x)^3
*tan(c) - 3*B*b*tan(d*x)^3*tan(c) + 3*C*a*tan(d*x)^2*tan(c)^2 + 3*B*b*tan(d*x)^2*tan(c)^2 - 3*C*a*tan(d*x)*tan
(c)^3 - 3*B*b*tan(d*x)*tan(c)^3 + 2*C*b*tan(d*x)^3 - 9*C*a*log(4*(tan(c)^2 + 1)/(tan(d*x)^4*tan(c)^2 - 2*tan(d
*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1))*tan(d*x)*tan(c) - 9*B*b*log(4*(tan(c
)^2 + 1)/(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1
))*tan(d*x)*tan(c) - 12*B*a*tan(d*x)^2*tan(c) + 18*C*b*tan(d*x)^2*tan(c) - 12*B*a*tan(d*x)*tan(c)^2 + 18*C*b*t
an(d*x)*tan(c)^2 + 2*C*b*tan(c)^3 - 6*B*a*d*x + 6*C*b*d*x + 3*C*a*tan(d*x)^2 + 3*B*b*tan(d*x)^2 - 3*C*a*tan(d*
x)*tan(c) - 3*B*b*tan(d*x)*tan(c) + 3*C*a*tan(c)^2 + 3*B*b*tan(c)^2 + 3*C*a*log(4*(tan(c)^2 + 1)/(tan(d*x)^4*t
an(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1)) + 3*B*b*log(4*(tan(
c)^2 + 1)/(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) +
1)) + 6*B*a*tan(d*x) - 6*C*b*tan(d*x) + 6*B*a*tan(c) - 6*C*b*tan(c) + 3*C*a + 3*B*b)/(d*tan(d*x)^3*tan(c)^3 -
3*d*tan(d*x)^2*tan(c)^2 + 3*d*tan(d*x)*tan(c) - d)